<html>
<head><meta charset="utf-8"><title>cgu partitioning brain dump · t-compiler/wg-incr-comp · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/index.html">t-compiler/wg-incr-comp</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html">cgu partitioning brain dump</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="206139266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206139266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206139266">(Aug 06 2020 at 13:20)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="212698">@Félix Fischer</span>! <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="206139585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206139585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206139585">(Aug 06 2020 at 13:23)</a>:</h4>
<p>So I guess the thing to start with is this PR <a href="https://github.com/rust-lang/rust/pull/74275">https://github.com/rust-lang/rust/pull/74275</a> which is relatively straightforward refactoring of the <code>partitioning</code> module.</p>



<a name="206139741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206139741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206139741">(Aug 06 2020 at 13:24)</a>:</h4>
<p>My main goal here was to make it easier for us to add new partitioning schemes for testing purposes. I'm not sure if we actually want different schemes in the future but making changes to the existing one just to test things out can be tricky because you can break the bootstrap and get much more complex errors than when you're testing simpler crates.</p>



<a name="206140387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206140387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206140387">(Aug 06 2020 at 13:29)</a>:</h4>
<p>Locally, I have a new scheme that is quite a bit simpler than the current one. Instead of partitioning the code initially by module/crate/etc (see <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/print/fn.characteristic_def_id_of_type.html"><code>characteristic_def_id_of_type</code></a>, it first looks at the <code>InliningMap</code> to see what monomorphic instantiations each item will bring in. It then uses the cost of the item and all of it's dependencies to create CGUs which are (hopefully) close in size. After that, we do the standard merge process where we take the two smallest and merge those together until we have the correct number of CGUs.</p>



<a name="206140607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206140607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206140607">(Aug 06 2020 at 13:30)</a>:</h4>
<p>I was hoping to see an improvement over the current algorithm for debug builds, but unfortunately it's slower. I've mostly been testing by building a copy of the <code>regex</code> crate locally and I think it's currently about 15 - 20% slower than the regular scheme.</p>



<a name="206140710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206140710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206140710">(Aug 06 2020 at 13:31)</a>:</h4>
<p>The code is quite a bit simpler IMO so this may just mean we need to do some additional tuning to close the gap.</p>



<a name="206140804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206140804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206140804">(Aug 06 2020 at 13:32)</a>:</h4>
<p>So, some ideas I have that might be worth exploring:</p>



<a name="206141046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206141046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206141046">(Aug 06 2020 at 13:34)</a>:</h4>
<ul>
<li>In addition to merging small CGUs, we should consider splitting large CGUs.<br>
    - I think this is our best bet for keeping incremental times consistent per crate.</li>
</ul>



<a name="206141352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206141352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206141352">(Aug 06 2020 at 13:36)</a>:</h4>
<ul>
<li>It looks like right now <code>#[inline]</code> items are instantiated in downstream crates (or perhaps each CGU that uses them?) even in debug mode.<ul>
<li>I think changing this so that we only have one instantiation of the inline item in the downstream crate (or perhaps we should even use an upstream instantiation?) is likely going to be a win even for the current algorithm.</li>
</ul>
</li>
</ul>



<a name="206141582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206141582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206141582">(Aug 06 2020 at 13:38)</a>:</h4>
<ul>
<li>If I understand the current algorithm correctly, each CGU gets copies of every <code>MonoItem</code> it uses. In debug mode, we should ideally be sharing those with our other CGUs. <ul>
<li>I think we may even want to have a way to calculate how much "duplication" of MonoItems is in a given compilation. This may be an important metric to know since it directly affects how much code we're handing to LLVM. (I've started working on some code to do this)</li>
</ul>
</li>
</ul>



<a name="206141827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206141827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206141827">(Aug 06 2020 at 13:40)</a>:</h4>
<ul>
<li>It would be great if, when partitioning, we could group together things that use the same MonoItems. <ul>
<li>This is another way to reduce the duplication but this might be suitable for release mode as well.</li>
</ul>
</li>
</ul>



<a name="206142492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206142492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206142492">(Aug 06 2020 at 13:45)</a>:</h4>
<ul>
<li>Partitioning relies pretty heavily on our code-size estimates being accurate. I know there are deficiencies here and we've tried to improve them in the past but sometimes we hit partitioning issues. (LOL)<ul>
<li>Doing a study here to find out approximately how many LLVM IR instructions each MIR statement actually generates and how that compares to our current estimates might be very useful. There is likely to be a trade off here on accuracy vs time spent generating the estimates. </li>
<li>Speaking of LLVM, I'm thinking we should actually leave estimating these costs up to the backend (which is pluggable) since cg_lift uses an entirely different IR. They might like to be able to provide better estimates for their backend (which potentially means there's more wins to be had from using cg_lift <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span> )</li>
</ul>
</li>
</ul>



<a name="206142829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206142829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206142829">(Aug 06 2020 at 13:47)</a>:</h4>
<p>So that's some ideas</p>



<a name="206142847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206142847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206142847">(Aug 06 2020 at 13:47)</a>:</h4>
<p>Um</p>



<a name="206142960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206142960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206142960">(Aug 06 2020 at 13:48)</a>:</h4>
<p>I guess there's still somethings I'm not sure about which would be worth understanding more thoroughly and (ideally) we could feed that back into the rustc dev guide.</p>



<a name="206143019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206143019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206143019">(Aug 06 2020 at 13:48)</a>:</h4>
<p>I have general ideas about what the partitioning (minus merging) will do but it would be great to have some basic examples that show exactly what's going on.</p>



<a name="206143871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206143871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206143871">(Aug 06 2020 at 13:55)</a>:</h4>
<p>For example, I'd love to have documented what the behavior is when you have:</p>
<table>
<thead>
<tr>
<th>Crate a</th>
<th>Crate b</th>
</tr>
</thead>
<tbody>
<tr>
<td>Non-generic function</td>
<td>Uses once in a module</td>
</tr>
<tr>
<td>Non-generic function</td>
<td>Uses in two different modules</td>
</tr>
<tr>
<td>Non-generic <code>#[inline]</code> function</td>
<td>Uses once in a module</td>
</tr>
<tr>
<td>Non-generic <code>#[inline]</code> function</td>
<td>Uses in two different modules</td>
</tr>
<tr>
<td>Generic function</td>
<td>Uses once in a module</td>
</tr>
<tr>
<td>Generic function</td>
<td>Uses in two different modules</td>
</tr>
<tr>
<td>Generic <code>#[inline]</code> function</td>
<td>Uses once in a module</td>
</tr>
<tr>
<td>Generic <code>#[inline]</code> function</td>
<td>Uses in two different modules</td>
</tr>
</tbody>
</table>



<a name="206144653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206144653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206144653">(Aug 06 2020 at 14:01)</a>:</h4>
<p>Other random things I'm just now thinking of:</p>
<ul>
<li>We should have a flag that dumps some diagnostic data after partitioning.<ul>
<li>Things I want to see:<ul>
<li>Stats about cgu sizes: what's the biggest? what's the smallest? what's the size distribution look like?</li>
<li>Are the cgus that are taking much longer or much shorter than we think they should? (are our estimates bad for some reason?) </li>
<li>Which cgus needed to be compiled? (Useful when doing incremental stuff)</li>
</ul>
</li>
</ul>
</li>
</ul>



<a name="206144776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206144776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206144776">(Aug 06 2020 at 14:02)</a>:</h4>
<ul>
<li>We should add cost estimates to the <code>self-profiler</code> data collection for each cgu.</li>
</ul>



<a name="206144900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206144900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206144900">(Aug 06 2020 at 14:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125250">Wesley Wiser</span> <a href="#narrow/stream/241847-t-compiler.2Fwg-incr-comp/topic/cgu.20partitioning.20brain.20dump/near/206142492">said</a>:</p>
<blockquote>
<ul>
<li>Speaking of LLVM, I'm thinking we should actually leave estimating these costs up to the backend (which is pluggable) since cg_lift uses an entirely different IR. They might like to be able to provide better estimates for their backend (which potentially means there's more wins to be had from using cg_lift <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span> )</li>
</ul>
</blockquote>
<p>I think the main difference between cg_clif and cg_llvm is that cg_llvm seems to force stack usage a bit more and then expects the mem2reg LLVM pass to cleanup after it. cg_clif tries hard to prevent the stack usage during ir generation, because it doesn't have a mem2reg like pass. This doesn't affect ir size that much I think and the current size estimator doesn't account for this (<a href="https://github.com/rust-lang/rust/blob/6e87bacd37539b7e7cd75152dffd225047fa983a/src/librustc_ty/ty.rs#L306">https://github.com/rust-lang/rust/blob/6e87bacd37539b7e7cd75152dffd225047fa983a/src/librustc_ty/ty.rs#L306</a>) in any way.</p>



<a name="206145306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206145306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206145306">(Aug 06 2020 at 14:06)</a>:</h4>
<p>Thanks <span class="user-mention" data-user-id="133247">@bjorn3</span>, that's good info!</p>



<a name="206158335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206158335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206158335">(Aug 06 2020 at 15:38)</a>:</h4>
<p>I would like to know what kinds of tradeoffs there are between &lt;size of CGUs&gt; and &lt;incremental compile times&gt;</p>



<a name="206158576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206158576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206158576">(Aug 06 2020 at 15:40)</a>:</h4>
<p>Like I wonder what would happen if in debug mode for example, we lifted the restriction in number of CGUs</p>



<a name="206158648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206158648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206158648">(Aug 06 2020 at 15:41)</a>:</h4>
<p>And just decided to skip the part where we "merge them based on the total number of CGUs"</p>



<a name="206158812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206158812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206158812">(Aug 06 2020 at 15:42)</a>:</h4>
<p>I think this could be useful for two reasons:</p>



<a name="206158909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206158909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206158909">(Aug 06 2020 at 15:42)</a>:</h4>
<ul>
<li>More fine-grained CGUs means less recompilation of code that was not changed.</li>
</ul>



<a name="206158943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206158943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206158943">(Aug 06 2020 at 15:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125250">Wesley Wiser</span> <a href="#narrow/stream/241847-t-compiler.2Fwg-incr-comp/topic/cgu.20partitioning.20brain.20dump/near/206142492">said</a>:</p>
<blockquote>
<ul>
<li>Partitioning relies pretty heavily on our code-size estimates being accurate. I know there are deficiencies here and we've tried to improve them in the past but sometimes we hit partitioning issues. (LOL)<ul>
<li>Doing a study here to find out approximately how many LLVM IR instructions each MIR statement actually generates and how that compares to our current estimates might be very useful. There is likely to be a trade off here on accuracy vs time spent generating the estimates. </li>
</ul>
</li>
</ul>
</blockquote>
<p>By the way, <span class="user-mention" data-user-id="125250">@Wesley Wiser</span> , do we currently gather <em>any</em> data on how (in)accurate our code size estimates are overall? For example, is there a debugflag one could use to get a table with a row for each function (or maybe each cgu?) and the columns are 1. estimated-code-size, 2. actual-code size in LLVM IR instructions, and 3. actual code size in machine instructions and/or bytes?</p>



<a name="206159189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206159189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206159189">(Aug 06 2020 at 15:45)</a>:</h4>
<p>I don't think we think we do, but we certainly should!</p>



<a name="206159258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206159258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206159258">(Aug 06 2020 at 15:45)</a>:</h4>
<p>(Cont.)</p>
<ul>
<li>When code changes, so do the sizes of the CGUs. This affects the merging step in a manner that the user cannot predict. This induces &lt;compile times&gt; changes that are hard to predict.</li>
</ul>



<a name="206160091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206160091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206160091">(Aug 06 2020 at 15:51)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> does that seem reasonable? I don't know what other tradeoffs are between merging and not merging CGUs, but maybe in debug builds we could do without the merging step, and make incr-comp both more fine grained (ie more efficient) as well as more predictable</p>



<a name="206161278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206161278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206161278">(Aug 06 2020 at 16:00)</a>:</h4>
<p>It does seem reasonable overall (or, at least, for some experiments). A few thoughts:</p>
<p>Smaller CGUs does give increased opportunity for incremental recompilation to be fast (as there is less extra code being recompiled). </p>
<p>I don't think there's any fundamental reason why we have to merge CGUs, I think it's just an improvement (mostly) over the original partitioning we have now. </p>
<p>At least with the current scheme, every CGU has to have all the mono items it needs to call (or for them to be available upstream). Having more CGUs will currently (I believe) increase the amount of mono item duplication.</p>



<a name="206161884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206161884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206161884">(Aug 06 2020 at 16:04)</a>:</h4>
<p>Interesting</p>



<a name="206161983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206161983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206161983">(Aug 06 2020 at 16:05)</a>:</h4>
<p>I think it's fine to have mono item duplication in cases where it helps compilation times</p>



<a name="206162087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206162087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206162087">(Aug 06 2020 at 16:06)</a>:</h4>
<p>I would still merge those if it turns out that merging is better for their times</p>



<a name="206162385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206162385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206162385">(Aug 06 2020 at 16:08)</a>:</h4>
<p>I think that in the general case, merging makes sense when you want to have a certain level of optimization across big swaths of code (because LLVM can optimize as much as it wants inside one CGU). For incr-comp, this would mean that <code>release</code> mode can be tuned to have more or less CGUs, and therefore less or more optimizations.</p>



<a name="206162484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206162484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206162484">(Aug 06 2020 at 16:09)</a>:</h4>
<p>Because in <code>release</code> mode we could want to have more LLVM optimizations available</p>



<a name="206162527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206162527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206162527">(Aug 06 2020 at 16:10)</a>:</h4>
<p>(Even at the cost of compile times)</p>



<a name="206162569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206162569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206162569">(Aug 06 2020 at 16:10)</a>:</h4>
<p>(Depending on how performant we want incremental <code>release</code> binaries to be)</p>



<a name="206162683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206162683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206162683">(Aug 06 2020 at 16:11)</a>:</h4>
<p>For <code>debug</code> builds I would disable any merging that does not help with compile times, however :3</p>



<a name="206291485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206291485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206291485">(Aug 07 2020 at 18:13)</a>:</h4>
<p>Yeah, there's a lot of complexity here so I think we certainly want our changes to be well motivated both from the theoretical perspective as well as concrete performance benchmarks.</p>



<a name="206319468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206319468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206319468">(Aug 07 2020 at 23:21)</a>:</h4>
<p>Indeed</p>



<a name="206319488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206319488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206319488">(Aug 07 2020 at 23:21)</a>:</h4>
<p>Mmm, now I want to make more performance tests</p>



<a name="206319537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206319537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206319537">(Aug 07 2020 at 23:22)</a>:</h4>
<p>But I don't know how much I should, since I cannot focus in both this and in helping nick with the bench suite</p>



<a name="206319550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206319550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206319550">(Aug 07 2020 at 23:22)</a>:</h4>
<p>(Specially after uni is done processing my thesis application)</p>



<a name="206319557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206319557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206319557">(Aug 07 2020 at 23:23)</a>:</h4>
<p>(I think I'll have space for just one of the two then)</p>



<a name="206320585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206320585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206320585">(Aug 07 2020 at 23:43)</a>:</h4>
<p>That's fine! Is there anything in particular you'd like to work on next so I don't start on that? If you're busy with other stuff right now, that's totally fine too <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="206324198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206324198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206324198">(Aug 08 2020 at 01:00)</a>:</h4>
<p>I think I'm currently busy with other stuff to start programming right away, but maybe I could start reading the relevant bits of the CGU partitioning stuff</p>



<a name="206324203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206324203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206324203">(Aug 08 2020 at 01:00)</a>:</h4>
<p>How big is that code?</p>



<a name="206470898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206470898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206470898">(Aug 10 2020 at 15:01)</a>:</h4>
<p>Also which files should one read? <span class="user-mention" data-user-id="125250">@Wesley Wiser</span> :)</p>



<a name="206485626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206485626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206485626">(Aug 10 2020 at 17:03)</a>:</h4>
<p><span class="user-mention" data-user-id="212698">@Félix Fischer</span> <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/monomorphize/partitioning.rs">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/monomorphize/partitioning.rs</a></p>
<p>The doc comment is 93 lines but the total file is about 1000 lines.</p>



<a name="206485728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206485728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206485728">(Aug 10 2020 at 17:04)</a>:</h4>
<p>Is everything in that file?</p>



<a name="206485738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206485738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206485738">(Aug 10 2020 at 17:04)</a>:</h4>
<p>:3</p>



<a name="206485808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206485808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206485808">(Aug 10 2020 at 17:05)</a>:</h4>
<p>Most everything related to cgu partitioning yeah</p>



<a name="206486484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206486484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206486484">(Aug 10 2020 at 17:11)</a>:</h4>
<p>A thought I’ve just had - can we leverage knowledge about the circumstances in which compiler shims are generated to put those mono items in compilation units that make more sense? (e.g. maybe drop shims don’t change much and aren’t often removed or replaced, so should be in their own codegen unit; but function pointer shims on the other hand are often changed alongside the mono item which spawned them?)</p>



<a name="206487284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206487284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206487284">(Aug 10 2020 at 17:19)</a>:</h4>
<p>What is a shim in this context?</p>



<a name="206488162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206488162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206488162">(Aug 10 2020 at 17:26)</a>:</h4>
<p>rustc generates MIR bodies in some contexts, for example: implementations of <code>drop_in_place&lt;T&gt;</code>, or of <code>Fn*</code> trait functions for a given function pointer.</p>



<a name="206488214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206488214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206488214">(Aug 10 2020 at 17:27)</a>:</h4>
<p>We know the context in which these shims get created, and that information might be leveraged by the partitioning.</p>



<a name="206490439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206490439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206490439">(Aug 10 2020 at 17:45)</a>:</h4>
<p>would moving all <code>drop_in_place</code> into one cgu result in recompiles of the whole cgu if we use a new instance of a generic type?</p>



<a name="206490614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206490614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206490614">(Aug 10 2020 at 17:46)</a>:</h4>
<p>without polymorphization we need seperate <code>drop_in_place</code> for <code>Vec&lt;u32&gt;</code> and <code>Vec&lt;u16&gt;</code>, don't we?</p>



<a name="206491342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491342">(Aug 10 2020 at 17:52)</a>:</h4>
<p>Yeah - my examples were very much artificial, I haven’t thought much about what useful partitioning we could do if we leveraged this information, just that we could leverage that information.</p>



<a name="206491360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491360">(Aug 10 2020 at 17:52)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> that feels accurate to me</p>



<a name="206491409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491409">(Aug 10 2020 at 17:53)</a>:</h4>
<p>Ahh, okay, I understand the context now, <span class="user-mention" data-user-id="116107">@davidtwco</span> :3</p>



<a name="206491548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491548">(Aug 10 2020 at 17:54)</a>:</h4>
<p>I think it is a good idea to keep in the list</p>



<a name="206491561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491561">(Aug 10 2020 at 17:54)</a>:</h4>
<p>Do we have a list?</p>



<a name="206491590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491590">(Aug 10 2020 at 17:55)</a>:</h4>
<p>(Like a hackmd)</p>



<a name="206491591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491591">(Aug 10 2020 at 17:55)</a>:</h4>
<p>It’s possible though that because those shims are constructed from just a type that much of the compiler wouldn’t need to be invoked - so even if they were recompiled more often, it might be really quick every time. Again, just speculation, but <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="206491677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491677">(Aug 10 2020 at 17:55)</a>:</h4>
<p>Yeah we need more measurement to really know without fiddling with the partitioning and seeing what happens</p>



<a name="206491740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491740">(Aug 10 2020 at 17:56)</a>:</h4>
<p>But I think it 100% makes sense</p>



<a name="206491764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491764">(Aug 10 2020 at 17:56)</a>:</h4>
<p>And also it would seem to me that it's closely related to polymorphization</p>



<a name="206491797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491797">(Aug 10 2020 at 17:56)</a>:</h4>
<p>As <span class="user-mention" data-user-id="216206">@lcnr</span> said</p>



<a name="206491839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491839">(Aug 10 2020 at 17:57)</a>:</h4>
<p>are we trying to polymorphize shims rn? <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> from what I can tell we aren't doing so rn...</p>



<a name="206491843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491843">(Aug 10 2020 at 17:57)</a>:</h4>
<p>Like maybe with PM enabled, most of this optimization would not be needed, I think</p>



<a name="206491995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206491995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206491995">(Aug 10 2020 at 17:58)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> is polimorphization already in-tree?</p>



<a name="206492004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492004">(Aug 10 2020 at 17:58)</a>:</h4>
<p>ye, but off by default</p>



<a name="206492024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492024">(Aug 10 2020 at 17:58)</a>:</h4>
<p><code>-Zpolymorphize=on</code></p>



<a name="206492043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492043">(Aug 10 2020 at 17:58)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> we do, they’re not treated separately but we’ve made changes in the past to shim building (e.g. <a href="https://github.com/rust-lang/rust/issues/75346">#75346</a>) that enables them to be polymorphic.</p>



<a name="206492045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492045">(Aug 10 2020 at 17:58)</a>:</h4>
<p>I seem to remember that last week it was not enabled... ahh, you're right. In-tree but off by default, yas</p>



<a name="206492208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492208">(Aug 10 2020 at 18:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> nice! :D</p>



<a name="206492214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492214">(Aug 10 2020 at 18:00)</a>:</h4>
<p>ahh, the reason why <code>drop_in_place</code> isn't polymorphized is then because it always uses a pointer to <code>T</code>?</p>



<a name="206492239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492239">(Aug 10 2020 at 18:00)</a>:</h4>
<p>I assume so, I’ve never dug into the MIR for it.</p>



<a name="206492443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492443">(Aug 10 2020 at 18:02)</a>:</h4>
<p>So assuming all shims are eventually captured by polimorphization, this optimization would mainly be useful for when compiling in <code>release</code> mode, right? Since (I'm assuming) <code>release</code> would turn off PM in order to get the most runtime performance available</p>



<a name="206492704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492704">(Aug 10 2020 at 18:04)</a>:</h4>
<p>PM does not have a negative runtime impact</p>



<a name="206492767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492767">(Aug 10 2020 at 18:05)</a>:</h4>
<p>we actually get some benefits because the binary is smaller (depending on how clever llvm is I guess <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> )</p>



<a name="206492800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492800">(Aug 10 2020 at 18:05)</a>:</h4>
<p>We do not virtualize function calls with polymorphization</p>



<a name="206492871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492871">(Aug 10 2020 at 18:06)</a>:</h4>
<p>Polymorphization just generates fewer copies of functions, if shouldn’t impact runtime performance. Polymorphization is run on all shims but that’s not to say that they will be polymorphized - depends how they use their generic parameters (if they have any). </p>
<p>If you have more questions, we can chat in <a class="stream" data-stream-id="216091" href="/#narrow/stream/216091-t-compiler.2Fwg-polymorphization">#t-compiler/wg-polymorphization</a> to keep this chat on-topic.</p>



<a name="206492969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206492969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206492969">(Aug 10 2020 at 18:07)</a>:</h4>
<blockquote>
<p>We do not virtualize function calls with polymorphization</p>
</blockquote>
<p>Holy cow. I do not understand how did you pull it off, then, David. I will surely go ask! Thanks for the time <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="206495767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206495767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206495767">(Aug 10 2020 at 18:32)</a>:</h4>
<p>Okay now I understand. We'd never disable polymorphization for runtime performance reasons :D</p>



<a name="206495884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206495884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Félix Fischer <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206495884">(Aug 10 2020 at 18:33)</a>:</h4>
<p>And at the same time, there are shims that will definitely not be polymorphisized</p>



<a name="206498238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/206498238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#206498238">(Aug 10 2020 at 18:51)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> I just realised - I don’t think we do actually polymorphize shims. I’m misremembering because we did have to make them capable of dealing with generic params (if the instance that spawned them was polymorphized). <code>Instance::polymorphize</code> has a check for <code>InstanceDef::Item</code> (ought to look into if that is necessary). That’s the last I’ll say about polymorphization here though to avoid going off topic.</p>



<a name="207111228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/207111228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#207111228">(Aug 17 2020 at 06:43)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> There is one way in which polymorphization would impact runtime performance: it reduces code size and thus instruction cache footprint.</p>



<a name="208609704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/208609704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#208609704">(Aug 31 2020 at 20:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125250">Wesley Wiser</span> <a href="#narrow/stream/241847-t-compiler.2Fwg-incr-comp/topic/cgu.20partitioning.20brain.20dump/near/206143871">said</a>:</p>
<blockquote>
<p>For example, I'd love to have documented what the behavior is when you have:</p>
<table>
<thead>
<tr>
<th>Crate a</th>
<th>Crate b</th>
</tr>
</thead>
<tbody>
<tr>
<td>Non-generic function</td>
<td>Uses once in a module</td>
</tr>
<tr>
<td>Non-generic function</td>
<td>Uses in two different modules</td>
</tr>
<tr>
<td>Non-generic <code>#[inline]</code> function</td>
<td>Uses once in a module</td>
</tr>
<tr>
<td>Non-generic <code>#[inline]</code> function</td>
<td>Uses in two different modules</td>
</tr>
<tr>
<td>Generic function</td>
<td>Uses once in a module</td>
</tr>
<tr>
<td>Generic function</td>
<td>Uses in two different modules</td>
</tr>
<tr>
<td>Generic <code>#[inline]</code> function</td>
<td>Uses once in a module</td>
</tr>
<tr>
<td>Generic <code>#[inline]</code> function</td>
<td>Uses in two different modules</td>
</tr>
</tbody>
</table>
</blockquote>
<p>Sorry I got occupied last week. <span class="user-mention" data-user-id="125250">@Wesley Wiser</span>  can you comment on how I can verify the behavior for these?</p>



<a name="208610136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/208610136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#208610136">(Aug 31 2020 at 20:19)</a>:</h4>
<p>would be great to keep filling rustc-dev-guide with more info ;)</p>



<a name="208935186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/208935186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#208935186">(Sep 03 2020 at 08:27)</a>:</h4>
<p>Where part of the dev guide should I add results of this testing to? I can't seem to find a particular section dedicated to incremental compile (there is a section in the query system) and the only detail I could find about partitioning was a comment on this <a href="https://rustc-dev-guide.rust-lang.org/backend/monomorph.html?highlight=partition#collection">page</a></p>



<a name="208935250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/208935250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#208935250">(Sep 03 2020 at 08:28)</a>:</h4>
<p>About the actual results I added more details on the issue itself: <a href="https://github.com/rust-lang/wg-incr-comp/issues/2">https://github.com/rust-lang/wg-incr-comp/issues/2</a></p>



<a name="208981202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/208981202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#208981202">(Sep 03 2020 at 15:05)</a>:</h4>
<p>Apologies to everyone trying to get a hold of me the last few days. I've been feeling a bit sick and haven't spent much time on Rust stuff. I'm feeling better now so hopefully I can dig out of the pile of Zulip and GitHub notifications over the next day or two! <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="208981299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/208981299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#208981299">(Sep 03 2020 at 15:05)</a>:</h4>
<p><span class="user-mention" data-user-id="281950">@Aman Arora</span> Sorry, I'll take a look at what you wrote on GitHub later today.</p>



<a name="209437214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/209437214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#209437214">(Sep 08 2020 at 20:06)</a>:</h4>
<p>rustc-dev-guide merged <a href="https://github.com/rust-lang/rustc-dev-guide/pull/847">https://github.com/rust-lang/rustc-dev-guide/pull/847</a>. <a href="https://github.com/rust-lang/wg-incr-comp/issues/2">https://github.com/rust-lang/wg-incr-comp/issues/2</a> can be closed.</p>



<a name="209437231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/209437231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#209437231">(Sep 08 2020 at 20:06)</a>:</h4>
<p>The information can be found here: <a href="https://rustc-dev-guide.rust-lang.org/backend/monomorph.html?highlight=mono#codegen-unit-cgu-partitioning">https://rustc-dev-guide.rust-lang.org/backend/monomorph.html?highlight=mono#codegen-unit-cgu-partitioning</a></p>



<a name="209458384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241847-t-compiler/wg-incr-comp/topic/cgu%20partitioning%20brain%20dump/near/209458384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/241847-t-compiler/wg-incr-comp/topic/cgu.20partitioning.20brain.20dump.html#209458384">(Sep 09 2020 at 00:00)</a>:</h4>
<p>Great work! <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>